#pragma once

class Expression
{
public:
    Expression() : m_value(0){};
    explicit Expression(int value) : m_value(value){};
    virtual ~Expression() = default;

public:
    virtual int interpret()
    {
        return m_value;
    };

private:
    int m_value;
};

class AddExpression : Expression
{
public:
    AddExpression(Expression *left, Expression *right) : m_left(left), m_right(right){};

public:
    int interpret() override
    {
        return m_left->interpret() + m_right->interpret();
    }

private:
    Expression *m_left;
    Expression *m_right;
};

class SubExcpression : Expression
{
public:
    SubExcpression(Expression *left, Expression *right) : m_left(left), m_right(right){};

public:
    int interpret() override
    {
        return m_left->interpret() - m_right->interpret();
    }

private:
    Expression *m_left;
    Expression *m_right;
};
